--叶佳豪201841052073
--闰年判断模块 输入为4位年份（16位二进制） 返回为结果
--***************************************
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
--*************************************************
ENTITY getISLeapYear IS
    PORT(	CLK 		:IN STD_LOGIC;
			YEAR		:IN STD_LOGIC_VECTOR(15 DOWNTO 0);
			RESULT     	:OUT std_logic
		);
END getISLeapYear;
--**************************************************
ARCHITECTURE RUN OF getISLeapYear IS
signal A,B,C	:STD_LOGIC;

BEGIN
	PROCESS(CLK,YEAR)
	BEGIN
		IF CLK'EVENT AND CLK = '1' THEN
			A <= ((NOT YEAR(4))AND(NOT YEAR(1))AND(NOT YEAR(0)))OR(YEAR(4)AND YEAR(1)AND(NOT YEAR(0)));
			B <= ((NOT YEAR(12))AND(NOT YEAR(9))AND(NOT YEAR(8)))OR(YEAR(12)AND YEAR(9) AND(NOT YEAR(8)));
			C <= YEAR(0) OR YEAR(1) OR YEAR(2) OR YEAR(3) OR YEAR(4) OR YEAR(5) OR YEAR(6) OR YEAR(7);
			RESULT<=(B AND (NOT C))OR(A AND B)OR(A AND C);
		END IF;
	END PROCESS; 
END RUN;

